<template>
  <view>
    <view class="u-page">
      <!-- 所有内容的容器 -->
    </view>
    <!-- 与包裹页面所有内容的元素u-page同级，且在它的下方 -->
    <u-tabbar v-model="$props.currentTab" :list="list" :mid-button="false" @change="tab_click"></u-tabbar>
  </view>
</template>

<script>
import pages from '@/pages.json'

export default {
  name: 'tabbar',
  props:['currentTab'],
  data() {
    return {
      current:0,
      list: [{
        iconPath: "home",
        selectedIconPath: "home-fill",
        text: '首页',
        count: 2,
        isDot: true,
        customIcon: false,
      },
        {
          // iconPath: "../../../static/img/tabbar/min_button.png",
          // selectedIconPath: "../../../static/img/tabbar/min_button_select.png",
          // text: '发布',
          // midButton: true,
          // customIcon: false,
          iconPath: "home",
          selectedIconPath: "home-fill",
          text: '首页',
          count: 2,
          isDot: true,
          customIcon: false,
        },
        {
          iconPath: "account",
          selectedIconPath: "account-fill",
          text: '我的',
          count: 23,
          isDot: false,
          customIcon: false,
        },
      ]

      //, current: 0
    }
  }, methods: {
    tab_click(e) {
      console.log(pages.tabBar.list[e])
      console.log(pages.tabBar.list[e].pagePath)
      uni.switchTab({
        url:'/'+pages.tabBar.list[e].pagePath
      })

      // uni.switchTab({
      //   url: this.switchTab[e]
      // })

    }
  }
}
</script>
